plat: zynqmp: Let fsbl_atf_handover() return an error status
authorSiva Durga Prasad Paladugu <[email protected]>
Thu, 17 May 2018 09:47:46 +0000 (15:17 +0530)
committerSiva Durga Prasad Paladugu <[email protected]>
Thu, 17 May 2018 09:47:46 +0000 (15:17 +0530)
Instead of calling panic() in fsbl_atf_handover() return the error
status so that bl31_early_platform_setup() can act accordingly.

Signed-off-by: Alistair Francis <[email protected]>
Signed-off-by: Siva Durga Prasad Paladugu <[email protected]>
plat/xilinx/zynqmp/bl31_zynqmp_setup.c
plat/xilinx/zynqmp/plat_startup.c
plat/xilinx/zynqmp/zynqmp_private.h

index 1edbd0f65009e2de30a86d378fa438ca3e1293d9..6dc1c2d22ae06dd04443d51dc69528467b6468fe 100644 (file)
@@ -77,7 +77,10 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
                                                  DISABLE_ALL_EXCEPTIONS);
        } else {
                /* use parameters from FSBL */
-               fsbl_atf_handover(&bl32_image_ep_info, &bl33_image_ep_info);
+               enum fsbl_handoff ret = fsbl_atf_handover(&bl32_image_ep_info,
+                                                         &bl33_image_ep_info);
+               if (ret != FSBL_HANDOFF_SUCCESS)
+                       panic();
        }
 
        NOTICE("BL31: Secure code at 0x%lx\n", bl32_image_ep_info.pc);
index 18d150c91433b666883b3ebc0ff3359c57e4861d..32c2db720dbed09108e371329b05a5a00678e20b 100644 (file)
@@ -9,6 +9,7 @@
 #include <debug.h>
 #include <mmio.h>
 #include "zynqmp_def.h"
+#include "zynqmp_private.h"
 
 /*
  * ATFHandoffParams
@@ -147,8 +148,11 @@ static int get_fsbl_estate(const struct xfsbl_partition *partition)
  *
  * Process the handoff paramters from the FSBL and populate the BL32 and BL33
  * image info structures accordingly.
+ *
+ * Return: Return the status of the handoff. The value will be from the
+ *         fsbl_handoff enum.
  */
-void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
+enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
 {
        uint64_t atf_handoff_addr;
        const struct xfsbl_atf_handoff_params *ATFHandoffParams;
@@ -158,7 +162,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
               (atf_handoff_addr > (uint64_t)&__BL31_END__));
        if (!atf_handoff_addr) {
                ERROR("BL31: No ATF handoff structure passed\n");
-               panic();
+               return FSBL_HANDOFF_NO_STRUCT;
        }
 
        ATFHandoffParams = (struct xfsbl_atf_handoff_params *)atf_handoff_addr;
@@ -168,7 +172,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
            (ATFHandoffParams->magic[3] != 'X')) {
                ERROR("BL31: invalid ATF handoff structure at %llx\n",
                      atf_handoff_addr);
-               panic();
+               return FSBL_HANDOFF_INVAL_STRUCT;
        }
 
        VERBOSE("BL31: ATF handoff params at:0x%llx, entries:%u\n",
@@ -176,7 +180,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
        if (ATFHandoffParams->num_entries > FSBL_MAX_PARTITIONS) {
                ERROR("BL31: ATF handoff params: too many partitions (%u/%u)\n",
                      ATFHandoffParams->num_entries, FSBL_MAX_PARTITIONS);
-               panic();
+               return FSBL_HANDOFF_TOO_MANY_PARTS;
        }
 
        /*
@@ -261,4 +265,6 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
                else
                        EP_SET_EE(image->h.attr, EP_EE_LITTLE);
        }
+
+       return FSBL_HANDOFF_SUCCESS;
 }
index aa650acb01ea061f57f72719e2e64405e6382544..3575b533cc290fd267bbd05260b8fe80c657844f 100644 (file)
@@ -18,7 +18,14 @@ int zynqmp_is_pmu_up(void);
 unsigned int zynqmp_get_bootmode(void);
 
 /* For FSBL handover */
-void fsbl_atf_handover(entry_point_info_t *bl32_image_ep_info,
+enum fsbl_handoff {
+       FSBL_HANDOFF_SUCCESS = 0,
+       FSBL_HANDOFF_NO_STRUCT,
+       FSBL_HANDOFF_INVAL_STRUCT,
+       FSBL_HANDOFF_TOO_MANY_PARTS,
+};
+
+enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32_image_ep_info,
                       entry_point_info_t *bl33_image_ep_info);
 
 #endif /* __ZYNQMP_PRIVATE_H__ */